﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WebQQ2.DLL
{
    /// <summary>
    /// 2011-1-5
    /// by hackren
    /// Email:hackren@vip.qq.com
    /// </summary>
    public class userEntity
    {
        //在多处用到的常量
        public readonly String appid = "15000101";
        private String username;

        public String Username
        {
            get { return username; }
            set { username = value; }
        }

        private string g_tk;

        /// <summary>
        /// 获取g_tk参数，
        /// </summary>
        //public string G_tk
        //{
        //    //get { return QzoneUtils.GetGtkByCookieSkey(Cookie).ToString(); }
        //}

        private String password;

        public String Password
        {
            get 
            {
                if (VerifyCode != "")
                {
                    return Utils.getMd5Hash2(Utils.getMd5Hash(password).ToUpper() + VerifyCode.ToUpper()).ToUpper();
                }
                else
                {
                    return "";
                }
            }
            set 
            {
                password = value;
            }
        }

        private String verifyCode;

        public String VerifyCode
        {
            get { return verifyCode; }
            set { verifyCode = value; }
        }

        /// <summary>
        /// 48位验证码算子
        /// </summary>
        private String verifyCode32;

        public String VerifyCode32
        {
            get { return verifyCode32; }
            set { verifyCode32 = value; }
        }

        private bool isOpenQzone;

        public bool IsOpenQzone
        {
            get { return isOpenQzone; }
            set { isOpenQzone = value; }
        }

        private UserStatus status;

        public UserStatus Status
        {
            get { return status; }
            set { status = value; }
        }

        private System.Net.CookieContainer cookie;

        public System.Net.CookieContainer Cookie
        {
            get { return cookie; }
            set { cookie = value; }
        }

        private string nickName;
        /// <summary>
        /// 昵称
        /// </summary>
        public string NickName
        {
            get { return nickName; }
            set { nickName = value; }
        }

        private string mPhone;

        /// <summary>
        /// 手机
        /// </summary>
        public string MPhone
        {
            get { return mPhone; }
            set { mPhone = value; }
        }

        private string telePhone;

        /// <summary>
        /// 电话
        /// </summary>
        public string TelePhone
        {
            get { return telePhone; }
            set { telePhone = value; }
        }

        private int sex;

        /// <summary>
        /// 性别1男2女
        /// </summary>
        public int Sex
        {
            get { return sex; }
            set { sex = value; }
        }

        private int age;

        /// <summary>
        /// 年龄
        /// </summary>
        public int Age
        {
            get { return age; }
            set { age = value; }
        }

        private string email;

        /// <summary>
        /// 邮箱
        /// </summary>
        public string Email
        {
            get { return email; }
            set { email = value; }
        }

        private string job;
        /// <summary>
        /// 职业
        /// </summary>
        public string Job
        {
            get { return job; }
            set { job = value; }
        }

        private string school;
        /// <summary>
        /// 学校
        /// </summary>
        public string School
        {
            get { return school; }
            set { school = value; }
        }

        private string homeUrl;
        /// <summary>
        /// 主页
        /// </summary>
        public string HomeUrl
        {
            get { return homeUrl; }
            set { homeUrl = value; }
        }

        private string personalElucidation;
        /// <summary>
        /// 个人说明
        /// </summary>
        public string PersonalElucidation
        {
            get { return personalElucidation; }
            set { personalElucidation = value; }
        }

        public string Skey
        {
            get
            {
                return WebQQUtil.GetGtkByCookieSkey("skey", Cookie);
            }
        }

        public string ptwebqq
        {
            get
            {
                return WebQQUtil.GetGtkByCookieSkey("ptwebqq", Cookie);
            }
        }

        private string key;

        /// <summary>
        /// vfwebqq
        /// </summary>
        public string Key
        {
            get { return key; }
            set { key = value; }
        }

        private string psessionid;

        public string Psessionid
        {
            get { return psessionid; }
            set { psessionid = value; }
        }

        private string clientId;

        public string ClientId
        {
            get { return clientId; }
            set { clientId = value; }
        }

        private Dictionary<int,string> groups;

        public Dictionary<int,string> Groups
        {
            get { return groups; }
            set { groups = value; }
        }

        private Dictionary<string,Friend> friends;

        public Dictionary<string,Friend> Friends
        {
            get { return friends; }
            set { friends = value; }
        }

        private Dictionary<string, QunEntity> quns;

        public Dictionary<string, QunEntity> Quns
        {
            get { return quns; }
            set { quns = value; }
        }
    }
}
